﻿//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------

using GameFramework;
using System;
using UnityEngine.UI;

namespace Adventure
{  
    public class HeadForm : UGuiForm
    {
        private Image headImage;
        protected override void OnInit(object userData)
        {
            base.OnInit(userData);
            headImage = transform.FindTransform<Image>("HeadImage");

            GetComponent<UIButton>().onClick.AddListener(()=> { PlayUISound(10001); Close(); });
        }
        protected override void OnOpen(object userData)
        {
            base.OnOpen(userData);

            headImage.SetSprite(Constant.SpriteCollectionPath, AssetUtility.GetUIDynamicSrpiteAsset((string)userData));

        }
    }
}
